#写函数，输出传入字符串中数字个数、字母个数、空格个数以及其他字符的个数
def count(str1):
    """
    :param str1: 传入字符串
    :return: 数字个数、字母个数、空格个数以及其他字符的个数
    """
    num_number = char_number = space_number = other_number = 0
    for char in str1:
        if char.isdigit():
            num_number += 1
        elif char.isalpha():
            char_number += 1
        elif char == ' ':
            space_number += 1
        else:
            other_number += 1
 
    print("数字个数：%d,字母个数：%d,空格个数：%d,其他字符：%d" % (num_number,char_number,space_number,other_number))
    return
count("gfsdhf  837498 >}45 fg")
